/*

 */
#ifndef    __LIBM_H__
#define    __LIBM_H__

#include <system.h>
#include <king_bg.h>
#include <nt.h>

/* global */
extern  char            __cBgColors;
extern  char            __cScreenMode;
extern  char            __cKanjiMode;
extern  char            __cDispStatus;
extern  unsigned short  __usKanjiColor;
extern  struct  BGPRM   ___BGparam;
extern  struct  BGCGADR ___BGcgadr;
extern  struct  CELPRM  __cel_param;
extern  char            __cel_stat;
extern  char            __cel_fb;

/* ＢＧ面番号 */
#define    KING_BG0     0
#define    KING_BG1     1
#define    KING_BG2     2
#define    KING_BG3     3

/* 画面サイズ */
#define    DISP_WIDE    0x9898  /* 512x256 */
#define    DISP_LONG    0x8989  /* 256x512 */
#define    DISP_NORMAL  0x8888  /* 256x256 */

/* カラーコード指定用 */
#define  YUV_BLACK      0x0088
#define  YUV_BLUE       0x1cf7
#define  YUV_RED        0x4c5f
#define  YUV_MAGENTA    0x69df
#define  YUV_GREEN      0x9531
#define  YUV_CYAN       0xb2b0
#define  YUV_YELLOW     0xe209
#define  YUV_WHITE      0xff88

/* 描画モード指定用 */
#define  PSET           0
#define  XOR            1

/* セロファン設定用 */
#define  CEL_BACK       1
#define  CEL_FRONT      3

enum DEVICES {
  DEV_7BG,
  DEV_7SP,
  DEV_KBG0,
  DEV_KBG1,
  DEV_KBG2,
  DEV_KBG3,
  DEV_RAIN };

enum CELLO {
  CEL_OFF,
  CEL_1,
  CEL_2,
  CEL_3 };

/* Ｃ６２７２制御用 */

int   KINGScreen(char screen_mode);
int   KINGCls(char bg_numer);
int   KINGTrans(char bg_number, unsigned short *picture_address, unsigned char blocks);
void  KINGInit(void);
void  KINGKanjiMode(char kanji_mode, unsigned short kanji_color);
void  KINGPuts(short cx, short cy, unsigned char *kanji_str);
int   KINGScroll(char bg_number, short cx, short cy);
void  KINGDispOn(void);
void  KINGDispOff(void);
void  KINGCylinder(char cBgNumber, char cCylMode);
void  KINGChangeSize0(unsigned short usSize);
void  KINGChangeSize1(unsigned short usSize);
void  KINGChangeSize2(unsigned short usSize);
void  KINGChangeSize3(unsigned short usSize);
int   KINGBoxFill(int intx, int inty, int endx, int endy, unsigned short color);
int   KINGBox(int intx, int inty, int endx, int endy, unsigned short color);
int   KINGGetRect(int intx, int inty, int endx, int endy, unsigned short *buffer);
int   KINGPutRect(int intx, int inty, int endx, int endy, unsigned short *buffer);

/* Ｃ６２６１制御用 */

void  NTInit(void);
void  NTCelMode(char cDeviceNo, char cCelMode);
void  NTFbCel(char cCelMode);
void  NTFixc(unsigned short usFixedColor);
void  NTCelSet1A(unsigned short usCelParam);
void  NTCelSet1B(unsigned short usCelParam);
void  NTCelSet2A(unsigned short usCelParam);
void  NTCelSet2B(unsigned short usCelParam);
void  NTCelSet3A(unsigned short usCelParam);
void  NTCelSet3B(unsigned short usCelParam);

#endif  /* __LIBM_H__ */
